﻿<div class="editor-label">
    @Helpers.TryRenderRequiredTag(ViewData.ModelMetadata.IsRequired)

    @Html.LabelFor(model => model)
</div>
<div class="editor-field">
    @if (ViewData.ModelMetadata.ModelType == typeof(DateTime))
    {
        var g = "D" + Guid.NewGuid().ToString("N");
        @Html.TextBox("",
        string.Format("{0:yyyy-MM-dd}",
        (DateTime)Model == DateTime.MinValue ? DateTime.Now.Date : (DateTime)Model.Date),
        new { id = g })
        <script type="text/javascript">            $(function () { $('#@(g)').datepicker(); });</script>
    }
    else
    {
        @Html.TextAreaFor(model => model,5,40,null)
    }
    @Html.ValidationMessageFor(model => model)
</div>
